<?php

class ClassBatchController extends GxController {

    public function actionBatchDeatils() {
        $venueId = $_POST['venueId'];
        $batchArry = ClassBatch:: getAllbatchByClass($_POST['classId'], $venueId);
        echo CJSON::encode($batchArry);
    }

    public function actionselectBatchdate() {
        $venueId = $_POST['venueId'];
        $batchArry = array();
        $batch = ClassBatch:: getAllbatchByClass($_POST['classId'], $venueId);
        foreach ($batch as $batchData) {
            if ($batchData['id'] == $_POST['batchid']) {
                $batchArry[] = array('id' => $batchData['id'], 'start_date' => $batchData['start_date'], 'price' => $batchData['price'], 'seats' => $batchData['seats'], 'start_time' => $batchData['start_time']);
            }
        }
        echo CJSON::encode($batchArry);
    }

    public function actionbatchDiscount() {
        ClassBatch::getBatchPriceBySeats($_POST['batchId'], $_POST['seats']);
    }

}